package com.itsm.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.itsm.entity.File;
import com.itsm.entity.User;
import com.itsm.service.mapper.FileMapper;
import com.itsm.service.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * 登录人员信息获取
 */
@Service
@DS("slave")
public class LoginService {

    @Autowired
    private FileMapper fileMapper;

    @Autowired
    private UserMapper userMapper;

    public String selectOrg3(String name,String num){
        File file = fileMapper.getFile(name,num);
        return file.getOrganizationLevel3();
    }

    /**
     *
     * @param name 名字
     * @param num 工号
     * @return 获取人员所在的一级部门
     */
    public String selectOrg1(String name,String num){
        return fileMapper.getFile(name,num).getOrganizationLevel1();

    }

//    public List<File> selectEn(String name,String num){
//        if(fileMapper.getFile(name,num)==null){
//            return null;
//        }
//        String org = fileMapper.getFile(name,num).getOrganizationLevel1();
//        if(org.equals("深圳和美精艺")||org.equals("江门和美精艺")){
//            return fileMapper.getEn1(fileMapper.getFile(name,num).getOrganizationLevel2());
//        }
//        return fileMapper.getEn(org);
////        List<File> file = fileMapper.getEn(org,"信息部");
//    }



    public String selectEnMobile(String name){
        return fileMapper.getEnMobile(name);

    }



//    public String selectCode(String name,String num){
//        File file = fileMapper.getFile(name,num);
//        return file.getDutyCode();
//    }




}
